#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    int t = (abs(a - b) + 1 )/ 2;
    cout << (t + c - 1) / c << endl;
}

signed main() {
    int t; cin >> t;
    while(t--) solve();
    return 0;
}